package com.service;

import com.mapper.AnnouncementMapper;
import com.service.impl.AnnouncementServiceImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;

/**
 * <p>
 * 宣传信息管理 Service 测试类
 * </p>
 * @author 34448
 */
public class AnnouncementServiceTest {

    @Mock
    private AnnouncementMapper announcementMapper;

    @InjectMocks
    private AnnouncementServiceImpl announcementService;

    @BeforeEach
    public void setUp() {
        MockitoAnnotations.openMocks(this);
    }

    @Test
    public void testCountAnnouncementPublications() {
        Integer expected = 10;

        when(announcementMapper.countAnnouncementPublications()).thenReturn(expected);

        Integer result = announcementService.countAnnouncementPublications();
        assertEquals(expected, result);
    }
}